package com.study.eureka;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component;

@FeignClient(value = "ServiceA", fallback = ServiceAClient.ServiceAFallBack.class)
public interface ServiceAClient extends ServiceAInterface {
    @Component
    class ServiceAFallBack implements ServiceAClient {

        @Override
        public String sayHello(Long id, String name, Integer age) {
            System.out.println("sayHello降级");
            return "sayHello降级";
        }

        @Override
        public String createUser(User user) {
            System.out.println("createUser降级");
            return "createUser降级";
        }

        @Override
        public String updateUser(Long id, User user) {
            System.out.println("updateUser降级");
            return "updateUser降级";
        }

        @Override
        public String deleteUser(Long id) {
            System.out.println("deleteUser降级");
            return "deleteUser降级";
        }

        @Override
        public User getById(Long id) {
            System.out.println("getById降级");
            return new User(-1L,"降级userName",10);
        }
    }
}
